|
Cytosim
PI
Cytoskeleton Simulator
|
Simple geometrical objects drawn with OpenGL. More...
Classes | |
| class | named_color |
| Holds the name and the RGBA components of a color. More... | |
Functions | |
| void | initialize () |
| initialize the arrays | |
| void | release () |
| release any memory | |
| void | initializeDL () |
| initialize the Display lists | |
| void | releaseDL () |
| release Display lists | |
| void | gleScale (real x) |
| void | gleScale (real x, real y, real z) |
| void | gleVertex (const Vector1 &v) |
| void | gleVertex (const Vector2 &v) |
| void | gleVertex (const Vector3 &v) |
| void | gleVertex (real x, real y) |
| void | gleVertex (real x, real y, real z) |
| void | gleNormal (const Vector1 &v) |
| void | gleNormal (const Vector2 &v) |
| void | gleNormal (const Vector3 &v) |
| void | gleTranslate (const Vector1 &v) |
| void | gleTranslate (const Vector2 &v) |
| void | gleTranslate (const Vector3 &v) |
| void | gleTranslate (real x, real y, real z) |
| void | gleRotate (real x, real y, real z, real t) |
| void | gleLoadMatrix (real *m) |
| void | gleRasterPos (const Vector1 &v) |
| void | gleRasterPos (const Vector2 &v) |
| void | gleRasterPos (const Vector3 &v) |
| void | gleVertex3v (const float *v) |
| void | gleVertex3v (const double *v) |
| void | gleNormal3v (const float *v) |
| void | gleNormal3v (const double *v) |
| void | gleAlignX (const Vector2 &v1) |
| align the X-axis to the given vector, by rotating around Z | |
| void | gleAlignZ (const Vector2 &A, const Vector2 &B) |
| translate by A, then rotate to align Z with AB (which is in the XY-plane) More... | |
| void | gleAlignZ (const Vector2 &A, const Vector2 &B, real ts) |
| translate by A, then rotate to align Z with AB, Z replaces X. The X-Y plane is scaled by ts More... | |
| void | gleRotate (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, bool inverse=false) |
| align the view to the three orthogonal vectors given | |
| void | gleTransRotate (const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &T) |
| translate by T, then rotate to align X with v1, Y with v2 and Z with v3 | |
| void | gleCircle0 () |
| call glVertex() along a centered 2D circle of radius 1 in plane XY | |
| void | gleCircleL () |
| void | gleCircleS () |
| void | gleTriangle0 () |
| draw a triangle of radius 1 in plane XY, normals pointing in +Z | |
| void | gleTriangleS () |
| void | gleTriangleL () |
| void | gleNabla0 () |
| draw a triangle of radius 1 in plane XY, normals pointing in +Z | |
| void | gleNablaS () |
| void | gleNablaL () |
| void | gleSquare0 () |
| draw a square of radius 1 in plane XY, normals pointing in +Z | |
| void | gleSquareL () |
| void | gleSquareS () |
| void | gleRectangle0 () |
| draw a square of radius 1 in plane XY, normals pointing in +Z | |
| void | gleRectangleL () |
| void | gleRectangleS () |
| void | glePlusS () |
| draw a PLUS of radius 1 in plane XY, normals pointing in +Z | |
| void | glePlusL () |
| void | glePentagon0 () |
| draw a pentagon of radius 1 in plane XY, normals pointing in +Z | |
| void | glePentagonS () |
| void | glePentagonL () |
| void | gleHexagon0 () |
| draw an hexagon of surface M_PI in plane XY, normals pointing in +Z More... | |
| void | gleHexagonS () |
| void | gleHexagonL () |
| void | gleStar0 () |
| draw a star of radius 1 in plane XY, normals pointing in +Z | |
| void | gleStarS () |
| void | gleStarL () |
| void | gleSphereN (int) |
| draw a sphere of radius 1 at origin, using a refined icosahedron | |
| void | gleSphere1 () |
| draw a sphere of radius 1 at origin | |
| void | gleSphere2 () |
| draw a nice sphere of radius 1 at origin | |
| void | gleSphere4 () |
| draw a very nice sphere of radius 1 at origin | |
| void | gleIcosahedron1 () |
| draw a icosahedron of radius 1 | |
| void | gleTube0 (GLfloat a, GLfloat b, int fin) |
a tube from a to b , radius 1 drawn with finesse fin | |
| void | gleTube1 () |
| draw an open tube along Z, of diameter 1 and length 1, Z=[0, 1] | |
| void | gleLongTube1 () |
| draw a tube along Z, of diameter 1 and length 2, Z=[-0.5, 1.5] | |
| void | gleTube2 () |
| draw a nicer open tube along Z, of diameter 1 and length 1 | |
| void | gleLongTube2 () |
| draw a tube along Z, of diameter 1 and length 2, Z=[-0.5, 1.5] | |
| void | gleCylinder1 () |
| draw a closed tube along Z, or diameter 1 and length 1 | |
| void | gleTubeZ (GLfloat za, GLfloat ra, gle_color, GLfloat zb, GLfloat rb, gle_color) |
| draw a tube along Z, of length 1, with specified radius and colors at the extermities | |
| void | gleBarrel1 () |
| draw a 3-portion cylinder with a larger central section | |
| void | gleCone1 () |
| display a cone directed along Z, of radius 1 in Z=[-1, +2] | |
| void | gleCylinderH () |
| display an flat-head at the origin, directed along Z, of length 1, radius 1 in Z=[-0.5, +0.5] | |
| void | gleDumbbell1 () |
| display a dumbbell align with the Z axis, or radius 1/3, lenth 1 | |
| void | gleArrowTail1 () |
| display a arrowtail aligned with the Z axis, or radius 1, lenth 2, Z=[-0.5, 1.5] | |
| void | gleArrowTail2 () |
| display 3 arrow fins aligned with the Z axis, or radius 1, lenth 2, Z=[-0.5, 1.5] More... | |
| void | gleArrowedBand (GLfloat width) |
| draw a circular band composed of triangles More... | |
| void | gleDecoratedSphere () |
| gleSphere4() with 3 ArrowedBands separating 8 quadrants | |
| void | gleRectangle (const int rect[4]) |
| a rectangle ( rect = [ left, bottom, right, top ] ) More... | |
| void | gleNiceRectangle (const int rect[4], int) |
| a rectangle with cut corners | |
| void | gleCircleLB () |
| void | gleCircleSB () |
| void | gleTube1B () |
| void | gleTube2B () |
| void | gleLongTube1B () |
| void | gleLongTube2B () |
| void | gleCone1B () |
| void | gleCylinderHB () |
| void | gleDumbbell1B () |
| void | gleIcosahedron1B () |
| void | gleArrowTail1B () |
| void | gleArrowTail2B () |
| void | gleSphere1B () |
| void | gleSphere2B () |
| void | gleSphere4B () |
| void | gleRevolution (GLfloat(*radius)(GLfloat)) |
| display a surface of revolution around the Z axis More... | |
| void | gleDualPass (void primitive()) |
| display back first, and then front More... | |
| void | gleObject (real radius, void(*obj)()) |
| draw the object specified by obj, scaled by radius | |
| void | gleObject (const Vector1 &x, real radius, void(*obj)()) |
| draw 'obj' scaled by radius at position 'x' | |
| void | gleObject (const Vector2 &x, real radius, void(*obj)()) |
| void | gleObject (const Vector3 &x, real radius, void(*obj)()) |
| void | gleObject (const Vector1 &x, const Vector1 &d, real radius, void(*obj)()) |
| draw 'obj' scaled by radius at position 'x', oriented along 'd' | |
| void | gleObject (const Vector2 &x, const Vector2 &d, real radius, void(*obj)()) |
| void | gleObject (const Vector3 &x, const Vector3 &d, real radius, void(*obj)()) |
| void | gleObject (const Vector1 &a, const Vector1 &b, void(*obj)()) |
| draw 'obj' scaled by radius at position 'x', oriented along 'd' | |
| void | gleObject (const Vector2 &a, const Vector2 &b, void(*obj)()) |
| void | gleObject (const Vector3 &a, const Vector3 &b, void(*obj)()) |
| void | gleObject (const Vector1 &x, const Vector1 &d, real radius, real length, void(*obj)()) |
| draw 'obj' scaled by radius at position 'x', oriented along 'd' | |
| void | gleObject (const Vector2 &x, const Vector2 &d, real radius, real length, void(*obj)()) |
| void | gleObject (const Vector3 &x, const Vector3 &d, real radius, real length, void(*obj)()) |
| void | gleTube (const Vector1 &a, const Vector1 &b, real radius, void(*obj)()=gleTube1B) |
| draw 'obj' with its ends at [a,b], of specified radius | |
| void | gleTube (const Vector2 &a, const Vector2 &b, real radius, void(*obj)()=gleTube1B) |
| void | gleTube (const Vector3 &a, const Vector3 &b, real radius, void(*obj)()=gleTube1B) |
| void | gleTube (const Vector1 &a, real, gle_color, const Vector1 &b, real, gle_color) |
| draw an open tube between A and B, with specified color and radius in A and B | |
| void | gleTube (const Vector2 &a, real, gle_color, const Vector2 &b, real, gle_color) |
| void | gleTube (const Vector3 &a, real, gle_color, const Vector3 &b, real, gle_color) |
| void | gleBand (const Vector1 &a, real, const Vector1 &b, real) |
| draw a band from A to B, with specified radius in A and B | |
| void | gleBand (const Vector2 &a, real, const Vector2 &b, real) |
| void | gleBand (const Vector1 &a, real, gle_color, const Vector1 &b, real, gle_color) |
| draw a band from A to B, with specified radius and colors in A and B | |
| void | gleBand (const Vector2 &a, real, gle_color, const Vector2 &b, real, gle_color) |
| void | gleDumbbell (const Vector2 &a, const Vector2 &b, real diameter) |
| draw two discs in A and B, connected with a line More... | |
| void | gleDumbbell (const Vector3 &a, const Vector3 &b, real diameter) |
| draw two spheres in A and B, connected with a cylinder | |
| void | gleCone (const Vector1 ¢er, const Vector1 &dir, real scale) |
| display cone, dir should be normalized | |
| void | gleCone (const Vector2 ¢er, const Vector2 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleCone (const Vector3 ¢er, const Vector3 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleCylinder (const Vector1 ¢er, const Vector1 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleCylinder (const Vector2 ¢er, const Vector2 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleCylinder (const Vector3 ¢er, const Vector3 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleArrowTail (const Vector1 ¢er, const Vector1 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleArrowTail (const Vector2 ¢er, const Vector2 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleArrowTail (const Vector3 ¢er, const Vector3 &dir, real scale) |
| display arrow-head, dir should be normalized | |
| void | gleArrow (const Vector1 &a, const Vector1 &b, real radius) |
| draw an arrow with ends [a,b], of specified radius | |
| void | gleArrow (const Vector2 &a, const Vector2 &b, real radius) |
| void | gleArrow (const Vector3 &a, const Vector3 &b, real radius) |
| int | gleLineHeight (void *font) |
| return height in pixel of GLUT font | |
| int | gleComputeTextSize (const char text[], void *font, int &lines) |
| compute size of text More... | |
| void | gleDisplayText (const char text[], void *font, gle_color bcol, int position, int width, int height) |
display text on a rectangle of color bcol, in a corner of the center of the display window More... | |
| void | gleDrawText (const char text[], void *font, GLfloat vshift=-13) |
| draw text at the current OpenGL raster position (specified by glRasterPos) More... | |
| void | gleDrawText (const Vector1 &pos, const char text[], void *font) |
draw text at position pos | |
| void | gleDrawText (const Vector2 &pos, const char text[], void *font) |
draw text at position pos | |
| void | gleDrawText (const Vector3 &pos, const char text[], void *font) |
draw text at position pos More... | |
| void | gleDrawPixels (int width, int height, int nbc, GLubyte rgba[], Vector2 pos, Vector2 dx, Vector2 dy) |
draw pixel array rgba containing 4 bytes per pixels More... | |
| void | gleDrawRectangle (const int rect[4], int window_width, int window_height) |
| display rectangle specified in pixel-coordinates | |
| void | gleDrawResizeBox (gle_color, int window_width, int window_height) |
| draw a rectangle to indicate the GLUT window-resize handle | |
| void | gleDrawAxes (GLfloat size, int dim=3) |
draw a set of 2 or 3 axes, depending on dim | |
| void | gleReportErrors (FILE *, const char *msg) |
| check and print OpenGL error(s) More... | |
| void | RGBtoHSV (GLfloat r, GLfloat g, GLfloat b, GLfloat *h, GLfloat *s, GLfloat *v) |
| conversion function from RGB to HSV color space More... | |
| void | HSVtoRGB (GLfloat h, GLfloat s, GLfloat v, GLfloat *r, GLfloat *g, GLfloat *b) |
| conversion functions from HSV to RGB color space | |
| void | setHueColor (GLfloat &r, GLfloat &g, GLfloat &b, GLfloat h) |
| set a RGB color from a factor in [0, 1], continuously varying through all colors More... | |
| gle_color | hueColor (GLfloat h, GLfloat a) |
| return colors aturated color with given Hue in [0, 1] | |
| void | gleHueColor (GLfloat h) |
| set saturated color with given Hue in [0, 1] | |
| void | gleHueColor (GLfloat h, GLfloat a) |
set saturated color with given Hue in [0, 1] and transparency a | |
| void | setJetColor (GLfloat &r, GLfloat &g, GLfloat &b, GLfloat h, GLfloat min) |
| set a RGB color from a factor in [0, 1], continuously varying through blue, green, red, white More... | |
| void | gleJetColor (GLfloat h, GLfloat alpha, GLfloat min=0.25) |
| set the current color from a factor in [0, 1] | |
| gle_color | jetColor (GLfloat h, GLfloat alpha, GLfloat min=0.25) |
| return color | |
| gle_color | nice_color (unsigned indx) |
| a small set of contrasted colors (indx is wrapped to the number of colors) | |
| gle_color | std_color (unsigned indx) |
| a set of standard colors (indx is wrapped to the number of colors) | |
| gle_color | std_color (const std::string &name) |
| a set of standard colors | |
| int | select_colors (gle_color *array, unsigned asize, GLfloat minb, GLfloat maxb) |
extract all Crayola colors having a brightness between minb and maxb More... | |
| gle_color | bright_color (unsigned indx, GLfloat minb=0.6, GLfloat maxb=3.0) |
| one of the crayola color, with a brightness() > threshold More... | |
| void | print_colors (std::ostream &, named_color *list, unsigned list_size) |
| print a list of colors | |
| void | print_std_colors (std::ostream &) |
| print the list of standard colors | |
| gle_color | alt_color (unsigned indx) |
| a large set of colors from Crayola crayons | |
Variables | |
| const int | finesse = 8 |
| this defines the number of triangles used to draw shapes, bigger = nicer More... | |
| GLuint | dlist = 0 |
| index of OpenGL display lists | |
| gle_color bright_color | ( | unsigned | indx, |
| GLfloat | minb = 0.6, |
||
| GLfloat | maxb = 3.0 |
||
| ) |
return indx-th color from the crayola list, that has a brightness between minb and maxb
Graphical elements are aligned in 3D along Z and this function is used to rotate them in the XY plane for the 2D display. The rotation is chosen such that the Y face of the rotated object points down the Z axis. In this way, the lower part of the object is drawn first, such that the upper half overwrites it and become the only visible part. The display is thus correct even if DEPTH_TEST is disabled.
ts is the transverse scaling done in the XY plane after rotation
| void gleArrowedBand | ( | GLfloat | width | ) |
A cylindrical band of specified width drawn on the equator of a sphere of radius 1. The band is in the XY plane. The axis of the cylinder is Z.
| void gleArrowTail2 | ( | ) |
Draw three fins like in the tail of an arrow
| int gleComputeTextSize | ( | const char | text[], |
| void * | font, | ||
| int & | lines | ||
| ) |
Compute the max width of all the lines in the given text This uses GLUT, which should be initialized.
| void gleDisplayText | ( | const char | text[], |
| void * | font, | ||
| gle_color | bcol, | ||
| int | position, | ||
| int | width, | ||
| int | height | ||
| ) |
The text is displayed in the current color. A background rectangle is displayed only if bcol is visible.
Possible values for position:
Note: width and height are the current size of the viewport (window)
| void gleDrawPixels | ( | int | width, |
| int | height, | ||
| int | nbc, | ||
| GLubyte | rgba[], | ||
| Vector2 | pos, | ||
| Vector2 | dx, | ||
| Vector2 | dy | ||
| ) |
Draw an array of pixels using GL_TRIANGLE_STRIP
The array rgba[] should ( nbc * width * height ) bytes, containing nbc-components (eg. RGBA) per pixel and stored by columns:
pos is the position of the top-left corner dx is the direction of the width dy is the direction of the height The magnitudes of dx and dy indicates the dimensions of a pixel. They may be of different magnitudes, and not necessarily orthogonal.
| void gleDrawText | ( | const char | text[], |
| void * | font, | ||
| GLfloat | vshift = -13 |
||
| ) |
draw the string character per character using: glutBitmapCharacter()
| void gleDrawText | ( | const Vector3 & | vec, |
| const char | text[], | ||
| void * | font | ||
| ) |
set the current raster position to w
| void gleDualPass | ( | void | primitive() | ) |
draw back first, and then front of object, GL_CULL_FACE should be enabled
Two hexagons linked by a rectangle
| void gleHexagon0 | ( | ) |
draw hexagon that has the same surface as the disc or Radius 1.
| void gleRectangle | ( | const int | rect[4] | ) |
rectangle should be specified as [ left, bottom, right, top ]
The rectangle will be drawn counter-clockwise
| void gleReportErrors | ( | FILE * | out, |
| const char * | msg | ||
| ) |
This is similart to glutReportError, but the additional argument can provide useful feedback for debugging
| void gleRevolution | ( | GLfloat(*)(GLfloat) | radius | ) |
Draw a surface of revolution around the Z-axis. The surface goes from Z=0 to Z=1, and its radius is given by the function radius(z) provided as argument.
| void RGBtoHSV | ( | GLfloat | r, |
| GLfloat | g, | ||
| GLfloat | b, | ||
| GLfloat * | h, | ||
| GLfloat * | s, | ||
| GLfloat * | v | ||
| ) |
r,g,b values are from 0 to 1 h = [0, 360], s = [0,1], v = [0,1] if s == 0, then h = -1 (undefined)
| int select_colors | ( | gle_color * | array, |
| unsigned | asize, | ||
| GLfloat | minb, | ||
| GLfloat | maxb | ||
| ) |
extract all colors from the crayola list, that have a brightness between minb and maxb
| void setHueColor | ( | GLfloat & | r, |
| GLfloat & | g, | ||
| GLfloat & | b, | ||
| GLfloat | h | ||
| ) |
set a RGB color as a function of a Hue value h in [0, 1]. The colors are in the order: red, green, blue, red
| void setJetColor | ( | GLfloat & | r, |
| GLfloat & | g, | ||
| GLfloat & | b, | ||
| GLfloat | h, | ||
| GLfloat | min | ||
| ) |
set a RGB color as a function of a value h in [0, 4]. The result vary from black, blue, cyan, yellow, orange to red.
| const int finesse = 8 |
finesse = 8 is good, 16 is nice, 32 should be very nice. To be able to change it during a run, we would need to update all the display lists